<template>
    <div :class="name">
        <div class="swiper-wrapper">
            <slot></slot>
        </div>
        <!-- 如果需要分页器 -->
        <!-- <div class="swiper-pagination"></div> -->
    </div>
</template>
<script>
// import Swiper from 'swiper'
// 全部引入对应的样式  导航栏  点  前进后退按钮
import Swiper from 'swiper/bundle'
// 导入全部样式
import 'swiper/css/bundle'
export default {
  props: {
    perview: {
      type: Number,
      default: 1
    },
    name: {
      type: String,
      default: 'swiper'
    }
  },

  mounted () {
    // console.log('mounted')
    new Swiper('.' + this.name, {
    //   loop: true, // 循环模式选项

      // 如果需要分页器
      //   pagination: {
      //     el: '.swiper-pagination'
      //   }

      slidesPerView: this.perview,
      spaceBetween: 30,
      freeMode: true
    })
  }
}
</script>
